package com.adv.vo;

import java.util.Arrays;
import java.util.List;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.adv.vo.group.Insert;
import com.adv.vo.group.Update;

public class UserForm {

	private Integer id;
	private String registertime;

	@Length(max = 50, message = "最多可以输入50个字符", groups = { Insert.class, Update.class })
	@NotBlank(message = "账户不能为空", groups = { Insert.class, Update.class })
	private String username;

	@Length(max = 50, message = "最多可以输入50个字符", groups = { Insert.class, Update.class })
	@NotBlank(message = "密码不能为空", groups = { Insert.class })
	private String password;

	private List<RoleForm> roles;

	@NotNull(message = "角色不能为空", groups = { Insert.class, Update.class })
	private Integer[] checkedRoles;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getRegistertime() {
		return registertime;
	}

	public void setRegistertime(String registertime) {
		this.registertime = registertime;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<RoleForm> getRoles() {
		return roles;
	}

	public void setRoles(List<RoleForm> roles) {
		this.roles = roles;
	}

	public Integer[] getCheckedRoles() {
		return checkedRoles;
	}

	public void setCheckedRoles(Integer[] checkedRoles) {
		this.checkedRoles = checkedRoles;
	}

	@Override
	public String toString() {
		return "UserForm [id=" + id + ", registertime=" + registertime + ", username=" + username + ", password="
				+ password + ", roles=" + roles + ", checkedRoles=" + Arrays.toString(checkedRoles) + "]";
	}

}
